﻿Imports System.Text
Imports System.Xml
Imports EAIws
Imports iMESCIO.SCI.Equipment.Request
Imports iMESCIO.SCI.Equipment.Response
Imports iMESCIOC.SCI.Integrate.Request
Imports iMESCIOC.SCI.Integrate.Response
Imports tcEAI

Public Class modERPIntegrate
    'EAI个案服务名，日志用
    Dim AccountID As String = String.Empty
    Public Sub New()

    End Sub

#Region "工具"

    'EAI標準日期格式轉換String to DateTime
    Public Function CDate_EAI(ByVal Value As String) As DateTime
        Dim strDate As String = ""
        Dim datDate As DateTime = defDateTime

        Try
            If Value.Length < 8 Then Exit Try
            '傳入YYYYMMDD,傳出YYYY/MM/DD
            strDate = Value.Substring(0, 4) & "/" & Value.Substring(4, 2) & "/" & Value.Substring(6, 2)
            If Value.Length < 14 Then Exit Try
            '傳入YYYYMMDDHHMMSS,傳出YYYY/MM/DD HH:MM:SS
            strDate = strDate & " " & Value.Substring(8, 2) & ":" & Value.Substring(10, 2) & ":" & Value.Substring(12, 2)
            '傳入YYYYMMDDHHMMSSFFF,傳出YYYY/MM/DD HH:MM:SS.fff
            If Value.Length < 17 Then Exit Try
            strDate = strDate & "." & Value.Substring(14, 3)
        Catch ex As Exception
            Throw
        Finally
            If strDate <> "" Then datDate = CDate(strDate)
            CDate_EAI = strDate
        End Try


    End Function
#End Region
End Class
